<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>计算属性</title>
    <script src="/js/vue.js"></script>
</head>
<body>
    <div id="app">
        <p>{{lastName+" "+firstName}}</p>
        <p>{{lastName+" "+firstName}}</p>
        <p>{{lastName+" "+firstName}}</p>
        <p>{{lastName+" "+firstName}}</p>

        <p>{{getFullName()}}</p>
        <p>{{getFullName()}}</p>
        <p>{{getFullName()}}</p>
        <p>{{getFullName()}}</p>

        <p>{{fullName}}</p>
        <p>{{fullName}}</p>
        <p>{{fullName}}</p>
        <p>{{fullName}}</p>
        <p>{{fullName}}</p>
    </div>
<br>
    <script>
        let app = new Vue({
            el:"#app",
            data:{
                firstName:'Shane',
                lastName:'He'
            },
            methods:{
                getFullName(){
                    console.log('function');
                    return this.lastName + " " + this.firstName
                }
            },
            computed:{
                fullName(){
                    console.log('computed');
                    return this.lastName + " " + this.firstName
                }
            }
        })
    </script>
</body>
</html>